//
//  UIBarButtonItem+WBExtension.m
//  微博项目
//
//  Created by ma c on 16/8/14.
//  Copyright (c) 2016年 beijing. All rights reserved.
//

#import "UIBarButtonItem+WBExtension.h"
#import "UIView+WBExtension.h"

@implementation UIBarButtonItem (WBExtension)

+ (UIBarButtonItem *)itemWithTarget:(id)target action:(SEL)action image:(NSString *)imageName hightImage:(NSString *)hightImageName{
    UIButton * btn = [UIButton buttonWithType:UIButtonTypeCustom];
    [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    [btn setBackgroundImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    [btn setBackgroundImage:[UIImage imageNamed:hightImageName] forState:UIControlStateHighlighted];
    btn.size = btn.currentBackgroundImage.size;
    return [[UIBarButtonItem alloc]initWithCustomView:btn];
}

@end
